home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / timepilot.swf / scripts / frame_31 / PlaceObject2_129_10 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2007-03-13  |  2.9 KB  |  106 lines

  1. onClipEvent(enterFrame){
  2.    if(Start == true)
  3.    {
  4.       rand++;
  5.       if(rand < 100)
  6.       {
  7.          rand = 100;
  8.       }
  9.       if(rand >= 450 - _root.Level * 10 && _root.Start == true)
  10.       {
  11.          if(_root.Enemy1Shot == false)
  12.          {
  13.             _root.enemyshot.start();
  14.             _root.EBullet._x = this._x;
  15.             _root.EBullet._y = this._y;
  16.             _root.EBullet.gotoAndPlay(1);
  17.             _root.EBullet.xspeed = Math.cos(rotate * 3.141592653589793 / 180) * 2;
  18.             _root.EBullet.yspeed = Math.sin(rotate * 3.141592653589793 / 180) * 2;
  19.             _root.EBullet.Start = true;
  20.             _root.Enemy1Shot = true;
  21.          }
  22.          else if(_root.Enemy2Shot == false && _root.LevelStage >= 3)
  23.          {
  24.             _root.missileshoot.start();
  25.             _root.EBullet2._x = this._x;
  26.             _root.EBullet2._y = this._y;
  27.             _root.EBullet2.gotoAndPlay(1);
  28.             _root.EBullet2.xspeed = 0;
  29.             _root.EBullet2.yspeed = 0;
  30.             _root.EBullet2.Start = true;
  31.             _root.Enemy2Shot = true;
  32.          }
  33.          rand = 0;
  34.       }
  35.       if(_X < -20)
  36.       {
  37.          _X = 470;
  38.       }
  39.       else if(_X > 470)
  40.       {
  41.          _X = -20;
  42.       }
  43.       if(_Y < 20)
  44.       {
  45.          _Y = 530;
  46.       }
  47.       else if(_Y > 530)
  48.       {
  49.          _Y = 20;
  50.       }
  51.       if(rotate < 0)
  52.       {
  53.          rotate += 360;
  54.       }
  55.       else if(rotate > 360)
  56.       {
  57.          rotate -= 360;
  58.       }
  59.       a = 1;
  60.       while(a <= _root.Ship.i)
  61.       {
  62.          if(this.hitTest(_root["Bullet" + a]))
  63.          {
  64.             hits += 1;
  65.             removeMovieClip(_root["Bullet" + a]);
  66.          }
  67.          a++;
  68.       }
  69.       if(hits > 1)
  70.       {
  71.          _root.PlanesShot += 1;
  72.          _root.NextBonus += 1;
  73.          if(_root.NextBonus >= 10)
  74.          {
  75.             _root.Bonus.Start = true;
  76.             _root.NextBonus = 0;
  77.          }
  78.          _root.LeftToKill -= 1;
  79.          if(_root.LeftToKill <= 0)
  80.          {
  81.             _root.LeftToKill = 0;
  82.             _root.Boss.Start = true;
  83.          }
  84.          _root.Score += 100;
  85.          this.gotoAndStop("Death");
  86.          Start = false;
  87.       }
  88.       _X = _X + (xspeed - Math.sin(_root.Ship.angle * 0.017453292519943295) * 3);
  89.       _Y = _Y + (yspeed + Math.cos(_root.Ship.angle * 0.017453292519943295) * 3);
  90.       if(_root.Start == true)
  91.       {
  92.          this.Movements.gotoAndStop(Math.ceil(rotate / 10) + 1);
  93.          xspeed = Math.cos(rotate * 3.141592653589793 / 180) * 1;
  94.          yspeed = Math.sin(rotate * 3.141592653589793 / 180) * 1;
  95.          rotate = Math.atan2(_root.Ship._y - this._y,_root.Ship._x - this._x) * 57.29577951308232;
  96.       }
  97.       if(_root.Ship.hitTest(_X,_Y,true) && _root.Ship.Dead == false)
  98.       {
  99.          this.gotoAndStop("Death");
  100.          _root.Ship.gotoAndStop("Death");
  101.          _root.Start = false;
  102.          _root.Ship.Dead = true;
  103.       }
  104.    }
  105. }
  106.